﻿using System.Linq;
using System;


namespace App.Model
{
    internal class Mock
    {
        private static Random random = new Random();

        public static bool CheckName(string source, string target)
        {
            string[] names = GetNames(target);
            return names.Any(name => string.Equals(source, name, StringComparison.OrdinalIgnoreCase));
        }

        public static int[][] zipArray(int[] array1, int[] array2)
        {
            return array1.Zip(array2, (a, b) => new int[] { a, b }).ToArray();
        }

        public static string[] GetNames(string label)
        {
            return new string[] { label + "-默认", label + "-基准" };
        }

        public static string[] GetTabs()
        {
            return new string[] { "气压", "温度", "流量" };
        }

        public static int[] GetSeriesData()
        {
            int[] points = new int[10];
            for (int i = 0; i < 10; i++)
            {
                points[i] = random.Next(100);
            }
            return points;
        }

        public static Record[] GetCheckboxData(string label)
        {
            int count = random.Next(3, 31);
            Record[] points = new Record[count];
            for (int i = 0; i < count; i++)
            {
                points[i] = new Record(label + (i + 1));
            }
            return points;
        }

        public static TreeModel GetTreeModel()
        {
            int Year = DateTime.Now.Year;
            int[] Month = Enumerable.Range(1, 12).ToArray();
            int[][] Leaf =
            {
                new int[] { 1, 3 },
                new int[] { 2, 3 },
                new int[] { 1, 2 },
                new int[] { 1, 3 },
                new int[] { 3 },
                new int[] { 1, 2 },
                new int[] { 1, 5 },
                new int[] { 2 },
                new int[] { 1 },
                new int[] { 2, 3 },
                new int[] { 3, 4 },
                new int[] { 1, 2 }
            };
            return new TreeModel(Year, Month, Leaf);
        }
    }
}